﻿using Net5ApiANdWpfClient.Lib.Common;
using Net5ApiANdWpfClient.Lib.Model;
using Net5ApiANdWpfClient.Lib.Model.SystemAdmin;
using Net5ApiANdWpfClient.Lib.Service;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace WpfClient.SystemManger
{
    /// <summary>
    /// OperatorManager.xaml 的交互逻辑
    /// </summary>
    public partial class OperatorManager : BaseUserControl
    {
        public OperatorManager()
        {
            InitializeComponent();
            operatorPage.PageSize = PcConfig.PageSize;
            operatorPage.PageCurrent = 1;
            Search();
        }
        public int Search()
        {
            string card = un.Text;
            string account = unf.Text;
            PagerResult<AdminUser> result = new AdminUserService().SearchPage(card, account, operatorPage.PageCurrent);
            if (result != null)
            {
                operatorList.DataContext = result.Data;
                operatorPage.NMax = result.recordsTotal;
                return result.recordsTotal;
            }
            return 0;
        }
        private void SearchBtn_Click(object sender, RoutedEventArgs e)
        {
            Search();
        }

        private int OperatorPage_EventPaging(Common.EventPagingArg e)
        {
            return Search();
        }

        private void AddBtn_Click(object sender, RoutedEventArgs e)
        {
            //  AdminUserAdd adminUserAdd = new AdminUserAdd();
            //  adminUserAdd.Show();
        }

        //编辑
        private void Edit_Click(object sender, RoutedEventArgs e)
        {
            AdminUser obj = (AdminUser)operatorList.CurrentItem;
            string result = obj.op_card;
            MessageBox.Show(result);
        }
        //删除
        private void Del_Click(object sender, RoutedEventArgs e)
        {
            
        }
    }
}
